package com.kl.modular.sysman.system.controller;

import com.alibaba.fastjson.JSON;
import com.kl.modular.common.controller.BaseController;
import com.kl.modular.system.dao.bo.SystemRoleAuthBo;
import com.kl.modular.system.dao.model.SystemRoleAuth;
import com.kl.modular.system.service.api.ISystemRoleAuthService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 角色与权限关系控制器
 * @author KONG_ZJB
 * @date 2016-08-05 22:11
 * @(C) XIGNSOFT Copyright 
 */
@Controller
public class SystemRoleAuthController extends BaseController {
	
	private static final Logger logger = LoggerFactory.getLogger(SystemRoleAuthController.class);
	
	@Autowired
	private ISystemRoleAuthService systemRoleAuthService;
	
	/**
	 * 角色与权限关系列表数据
	 */
	@RequestMapping(value = "/sysman/systemRoleAuth/systemRoleAuthAjaxList", method = RequestMethod.POST)
	@ResponseBody
	@RequiresPermissions("sysman:SYSTEM_ROLE_MAN:add")
	public String queryAjaxList(SystemRoleAuthBo systemRoleAuthBo, HttpServletRequest request) {
		logger.info("systemRoleAuth列表数据>>data:" + JSON.toJSONString(systemRoleAuthBo));
		if (systemRoleAuthBo == null) {	
			systemRoleAuthBo = new SystemRoleAuthBo();
		}
		List<SystemRoleAuth> systemRoleAuthList = systemRoleAuthService.getListByBo(systemRoleAuthBo);
		return JSON.toJSONString(systemRoleAuthList);
	}

}
